/*
 * Camera.h
 *
 *  Created on: 2018年12月21日
 *      Author: terry
 */

#ifndef CAMERA_H_
#define CAMERA_H_

#include "BasicType.h"
#include <string>

#include "DShowDeviceGraph.h"

class Camera
{
public:
	struct Info
	{
		std::string	m_name;
		int		m_index;

		Info() :
			m_name(),
			m_index()
		{
		}

		Info(const std::string& name, int idx) :
			m_name(name),
			m_index(idx)
		{
		}

		bool empty() const
		{
			return m_name.empty();
		}
	};

	typedef std::vector< Info >	Infos;

	static int listCamera(Infos& infos);

public:
	Camera();
	virtual ~Camera();

	bool open(const std::string& name, int index);
	void close();

	void setVideoWindow(HWND hwnd);

	bool play();
	void pause();
	void stop();

protected:
	DShowDeviceGraph	m_graph;
};

#endif /* CAMERA_H_ */
